package com.example.studyplanning.servicesImpl;

import com.example.studyplanning.entity.Task;
import com.example.studyplanning.entity.User;
import com.example.studyplanning.mapper.TaskMapper;
import com.example.studyplanning.services.TaskServices;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

@Service
public class TaskServicesImpl implements TaskServices {
    @Autowired
    private TaskMapper taskMapper;

    @Override
    public List<Task> findAllTask(){return taskMapper.findAllTask();}

    @Override
    public Integer insertTask(Task task) {
        return taskMapper.insertTask(task);
    }

    @Override
    public Integer DelTaskByID(Integer taskID) {
        return taskMapper.DelTaskByID(taskID);
    }

    @Override
    public Integer UpdateTask(Task task) {
        return taskMapper.UpdateTask(task);
    }

    @Override
    public Integer UpdateLive(Integer taskID) {
        return taskMapper.UpdateLive(taskID);
    }

    @Override
    public List<Task> findTaskByName(String taskName) {
        return taskMapper.findTaskByName(taskName);
    }

    @Override
    public List<Task> SelectByDate(String date_time,Integer userID) {
        return taskMapper.SelectByDate(date_time,userID);
    }

    @Override
    public Integer UpdateTaskLive(Integer taskID) {
        return taskMapper.UpdateTaskLive(taskID);
    }

    @Override
    public List<Task> findByDate(String date_time,Integer userID) {
        return taskMapper.findByDate(date_time,userID);
    }

    @Override
    public List<Task> findListByDate(String date_time,Integer userID) {
        return taskMapper.findListByDate(date_time,userID);
    }

    @Override
    public Integer UpdateTheTask(Task task) {
        return taskMapper.UpdateTheTask(task);
    }

    @Override
    public Integer SelectSumTime(String date_time, Integer userID) {
        return taskMapper.SelectSumTime(date_time,userID);
    }

    @Override
    public PageInfo<Task> SelectTheTask(Integer num,Integer taskID,String taskName,String taskClass,Integer taskType,Integer taskTime,Integer userID,Integer taskLive) {
        PageHelper.startPage(num,5);
        List<Task> lists=taskMapper.SelectTheTask(taskID,taskName,taskClass,taskType,taskTime,userID,taskLive);
        PageInfo<Task> pageInfo = new PageInfo<>(lists);
        return pageInfo;
}
    @Override
    public PageInfo<Task> SelectTask(Integer num,String date_time,Integer taskID,String taskName,String taskClass,Integer taskType,Integer taskTime,Integer userID,Integer taskLive) {
        PageHelper.startPage(num,5);
        List<Task> lists=taskMapper.SelectTask(date_time,taskID,taskName,taskClass,taskType,taskTime,userID,taskLive);
        PageInfo<Task> pageInfo = new PageInfo<>(lists);
        return pageInfo;
    }

    @Override
    public Integer SelectSumTodo(String date_time, Integer userID) {
        return taskMapper.SelectSumTodo(date_time, userID);
    }

    @Override
    public Integer SelectSumClock(String date_time, Integer userID) {
        return taskMapper.SelectSumClock(date_time, userID);
    }

    @Override
    public Integer SelectFinishedTodo(String date_time, Integer userID) {
        return taskMapper.SelectFinishedTodo(date_time, userID);
    }

    @Override
    public Integer SelectFinishedClock(String date_time, Integer userID) {
        return taskMapper.SelectFinishedClock(date_time, userID);
    }


    //echarts

    @Override
    public List<Task> findAlltask() {
        List<Task>list=taskMapper.findAlltask();
        return list;
    }

    @Override
    public List<Task> findAlltaskToDo() {
        List<Task>list=taskMapper.findAlltaskToDo();
        return list;
    }

    @Override
    public List<Task> countAlltaskClock() {
        List<Task>list=taskMapper.countAlltaskClock();
        return list;
    }


    @Override
    public List<Task> countAlltoDoUser() {
        List<Task>list=taskMapper.countAlltoDoUser();
        return list;
    }

    @Override
    public List<Task> countAllclockUser() {
        List<Task>list=taskMapper.countAllclockUser();
        return list;
    }

}
